package com.chinasoft.movie;

import org.apache.ibatis.javassist.bytecode.analysis.Executor;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.validation.constraints.Null;
import javax.xml.transform.Result;
import java.util.concurrent.*;

@SpringBootTest
public class tt {
    @Test
    public void t() throws Exception{
        SS s = new SS(1);
        System.gc();
        FutureTask<Boolean> futureTask = new FutureTask<Boolean>(s);
        new Thread(futureTask).start();
        Boolean w = futureTask.get();
        System.out.println(w);

        ExecutorService executorService = Executors.newFixedThreadPool(5);
        Future<Boolean> future = executorService.submit(s);
        Boolean e = future.get();


    }
}

class SS implements Callable<Boolean>{
    int i;
    public SS(int j){
        i=j;
    }
    public Boolean call() throws Exception{
        for(int j = 0;j<100;j++){
            System.out.println(Thread.currentThread().getName()+"拿到了"+i++);
        }
        return true;
    }
}
